#include <REGX52.H>
#include <stdio.h>
#include <string.h>
sbit KEY_1 = P0^0;
sbit KEY_2 = P0^3;
sbit KEY_3 = P0^6;
sbit KEY_4 = P2^6;
sbit KEY_5 = P2^3;
sbit KEY_6 = P2^0;

void delay_ms(unsigned int ms)
{
    unsigned int i, j;
    for (i = 0; i < ms; i++)
    {
        for (j = 0; j < 123; j++)
        ;
    }
}
void uart_init()
{
    //9600
    TMOD &= 0x0F;

    TMOD |= 0x20;


    TH1 = 0xFD;
    TL1 = 0xFD;
    
    TR1 = 1;

    
    SCON = 0x50;
    
    PCON = 0x00;
    
    ES = 1;
    
    EA = 1;
    
    TI = 1;
}

/**
 * 基于已有的电路，编写代码点亮LED
 */

void main()
{
    uart_init();
    while(1)
    {
     if(KEY_1==0)
     {
      delay_ms(50);
      if(KEY_1==0)
      {
       while(KEY_1==0);
       printf("one\n");
      }
     }
    if(KEY_2==0)
     {
      delay_ms(50);
      if(KEY_2==0)
      {
       while(KEY_2==0);
       printf("two\n");
      }
     }
     if(KEY_3==0)
     {
      delay_ms(50);
      if(KEY_3==0)
      {
       while(KEY_3==0);
       printf("three\n");
      }
     }
    if(KEY_4==0)
     {
      delay_ms(50);
      if(KEY_4==0)
      {
       while(KEY_4==0);
       printf("four\n");
      }
     }
     if(KEY_5==0)
     {
      delay_ms(50);
      if(KEY_5==0)
      {
       while(KEY_5==0);
       printf("five\n");
      }
     }
    if(KEY_6==0)
     {
      delay_ms(50);
      if(KEY_6==0)
      {
       while(KEY_6==0);
       printf("six\n");
      }
     }
    }
}